//package com.getway.controller.itemcontroller;
//
//import com.alibaba.fastjson.JSONObject;
//import com.common.contant.RestResponse;
//import com.getway.client.ItemClient;
//import com.getway.dto.BrandDTO;
//import com.getway.dto.CategoryDTO;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//import java.util.Map;
//
///**
// * @Author: sijunqiang
// * @Date: 2020/5/18 15:14
// * @Description:
// */
//@RestController
//@Slf4j
//@RequestMapping(value = "category")
//@RequiredArgsConstructor(onConstructor = @__(@Autowired))
//public class ItemController {
//
//    private final ItemClient itemClient;
//
////    /**
////     * 获取商品分类的的列表
////     */
////    @RequestMapping(value = "/list", method = RequestMethod.GET)
////    public RestResponse<List<CategoryDTO>> queryByParentId(Long pid) {
////        log.info("获取商品分类的请求参数：pid:[{}]", pid);
////        RestResponse<List<CategoryDTO>> listRestResponse = itemClient.queryByParentId(pid);
////        log.info("商品服务响应的结果：[{}]", JSONObject.toJSONString(listRestResponse));
////        return listRestResponse;
////
////
////    }
//
//
//    /**
//     * 获取商品分类的的列表
//     */
//    @RequestMapping(value = "/list", method = RequestMethod.GET)
//    public ResponseEntity queryByParentId(Long pid) {
//        log.info("获取商品分类的请求参数：pid:[{}]", pid);
//        RestResponse<List<CategoryDTO>> listRestResponse = itemClient.queryByParentId(pid);
//        log.info("商品服务响应的结果：[{}]", JSONObject.toJSONString(listRestResponse));
//        List<CategoryDTO> data = listRestResponse.getData();
//        return ResponseEntity.ok(data);
//    }
//
//
//    /**
//     * 获取商品分类的的列表
//     */
//    @RequestMapping(value = "/category/of/parent", method = RequestMethod.GET)
//    public ResponseEntity queryCategoryList(Long pid) {
//        log.info("获取商品分类的请求参数：pid:[{}]", pid);
//        RestResponse<List<CategoryDTO>> listRestResponse = itemClient.queryByParentId(pid);
//        log.info("商品服务响应的结果：[{}]", JSONObject.toJSONString(listRestResponse));
//        List<CategoryDTO> data = listRestResponse.getData();
//        return ResponseEntity.ok(data);
//    }
//
//    /**
//     * 保存品牌
//     */
//
//    @PostMapping(value = "save/brand")
//    public RestResponse saveBrand(@RequestBody BrandDTO brandDTO, @RequestParam("cids") List<Long> cids) {
//        log.info(">>>>>>>>>保存品牌请求参数: brand:[{}], 分类的id：[{}]>>>>>>>>>>", JSONObject.toJSONString(brandDTO), JSONObject.toJSONString(cids));
//        itemClient.saveBrand(brandDTO, cids);
//        return RestResponse.success(HttpStatus.CREATED);
//    }
//
//    /**
//     * 根据品牌的id 查询商品类目信息
//     *
//     * @param id 品牌的id
//     * @return
//     */
//    @GetMapping(value = "/of/brand")
//    public RestResponse queryByBrandId(@RequestParam(value = "id") Long id) {
//        log.info(">>>>打印根据品牌的id获取商品类目请求参数:[{}]>>>>", id);
//        RestResponse restResponse = itemClient.queryByBrandId(id);
//        return RestResponse.success(restResponse.getData());
//    }
//}
